package spring.bean;

import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import spring.inters.HelloApi;
import spring.model.Printer;

public class MethodInjectTest {
	@Test
	public void testLookup() {
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("src/main/resources/lookupMethodInject.xml");
		System.out.println("==singleton sayHello==");
		HelloApi sayHello = context.getBean("helloApi1", HelloApi.class);
		sayHello.sayHello();

		System.out.println("====prototype sayHello=====");
		HelloApi sayHello1 = context.getBean("helloApi2", HelloApi.class);
		sayHello1.sayHello();
	}
	
	
	@Test
	public void testMethodReplace(){
		ClassPathXmlApplicationContext context=new ClassPathXmlApplicationContext("src/main/resources/methodReplacerInject.xml");
		Printer printer=context.getBean("printer",Printer.class);
		printer.print("printer MethodReplacer");
	}
	
}
